import React, {Component} from 'react';
import {Text, TouchableOpacity, View} from 'react-native';
import Styles from './Styles';

export default class Detail1 extends BaseComponent {
    //接收上一个页面传过来的title显示出来
    static navigationOptions = ({navigation}) => ({
        title: navigation.state.params.title
    });
    // 点击返回上一页方法
    backMain = () => {
        //返回首页方法
        this.props.navigation.goBack();
    };

    render() {
        const {navigate} = this.props.navigation;
        return (
            <View style={Styles.container}>
                <TouchableOpacity
                    style={{
                        height: 40,
                        backgroundColor: 'green',
                        justifyContent: 'center'
                    }}
                    onPress={() => {
                        this.backMain();
                    }}>
                    <Text>{this.props.navigation.state.params.des}</Text>
                </TouchableOpacity>
            </View>
        );
    }
}